﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using control.Biz;

namespace BaiTapDoAn
{
    public partial class ThongKeTheoChuDe : Form
    {
        List<BizSach> tks = new List<BizSach>();
        List<BizChuDe> cds = new List<BizChuDe>();
        public ThongKeTheoChuDe()
        {
            InitializeComponent();
        }

        private void button_XemTKDT_Click(object sender, EventArgs e)
        {
            
            int idChuDe = int.Parse(combx_tkchude.SelectedValue.ToString());
            tks = BizSach.XemTKTheoChuDe(idChuDe, datetp_TKBatdau.Value, dateTP_TKngayKT.Value);

            dataGridView_DSTKCD.AutoGenerateColumns = false;
            dataGridView_DSTKCD.DataSource = tks;
        }

        private void ThongKeTheoChuDe_Load(object sender, EventArgs e)
        {
            cds = BizChuDe.GetAll();
            cds.Add(new BizChuDe(0, "- - - Tất Cả - - -"));
            combx_tkchude.DataSource = cds;
            combx_tkchude.Text = "- - - Tất Cả - - -";

           
        }

        private void button_In_Click(object sender, EventArgs e)
        {
            ////gan datasource
            //CrystalReport_TKCD tkcd = new CrystalReport_TKCD();
            //tkcd.SetDataSource(dataGridView_DSTKCD.DataSource);
            
            ////thiet lap parameter
            //int idChuDe = int.Parse(combx_tkchude.SelectedValue.ToString());
            //if(idChuDe == 0)
            //    tkcd.SetParameterValue("ChuDe", "Tất cả chủ đề");
            //else
            //    tkcd.SetParameterValue("ChuDe", combx_tkchude.Text);
            //tkcd.SetParameterValue("NgayBatDau",datetp_TKBatdau.Value.ToString("dd/MM/yyyy"));
            //tkcd.SetParameterValue("NgayKetThuc", dateTP_TKngayKT.Value.ToString("dd/MM/yyyy"));
            //crystalReportViewer1.ReportSource = tkcd;
        }
    }
}
